/*
 * @Author: @yzcheng
 * @Date: 2021-04-01 09:14:34
 * @Version: 1.0
 * @LastEditors: @yzcheng
 * @Description:
 * @LastEditTime: 2021-05-18 11:01:14
 */
import { createStore, useStore as baseUseStore, Store } from 'vuex'
import { InjectionKey } from 'vue'
import paragraph from './modules/paragraph'
import road from './modules/road'
import global from './modules/global'
import getters from './getters'
import { ObjectType } from 'typings/interfaces.js'
import tagsView from './tagsView.js'
import technologyStrength from './modules/technologyStrength'
import technicalNorms from './modules/technicalNorms'
import technologyRewards from './modules/technologyRewards'

import innovativeTalents from './modules/innovativeTalents'
import userList from './modules/userList'
import projectCenter from './modules/projectCenter'
import system from './modules/system'
import expert from './modules/expert'
import lxsq from './modules/lxsq'
import common from './modules/common'


import flowClassifyStore from './processControl/flowClassifyStore.js'
import flowDefineStore from './processControl/flowDefineStore.js'
import flowDesignStore from './processControl/flowDesignStore.js'
import flowInstance from './processControl/flowInstance.js'
import flowTaskStore from './processControl/flowTaskStore.js'

import historyListStore from './processHandle/historyListStore.js'
import readingStore from './processHandle/readingStore.js'
import todoListStore from './processHandle/todoListStore.js'
import permission from './modules/permission'
import router from './modules/router'
import App from './app'



export interface State {
  [x: string]: any
  technologyStrength: any
  count: number
}

export const key: InjectionKey<Store<State>> = Symbol()

export const store = createStore<State>({
  modules: {
    common,
    global,
    tagsView,
    paragraph,
    road,
    technologyStrength,
    technicalNorms,
    technologyRewards,
    innovativeTalents,
    userList,
    projectCenter,
    system,
    expert,
    // permission,
    router,
    lxsq,
    flowDesignStore,
    flowClassifyStore,
    flowDefineStore,
    todoListStore,
    historyListStore,
    flowTaskStore,
    flowInstance,
    readingStore,
    App,
  },
  getters,
})

// define your own `useStore` composition function
export function useStore(): ObjectType {
  return baseUseStore(key)
}
